
<template>
  <div id="tmpl">
   <div class="top">
       <h3>{{info.title}}</h3>
       <p><span>发表时间：{{info.add_time | datefmt('YYYY-MM-DD HH:mm:ss')}}</span> <span>浏览次数{{info.click}}</span></p>
   </div>
   <div class="content" v-html="info.content"></div>

    <common :id="id">
        
    </common>


  </div>
</template>

<script>
import { Toast } from 'mint-ui';
import common from "../common/common.vue";

export default {
    components:{
        common
    },
    data(){
        return{
            id:0,
            info:{}
        }
    },
    created(){
        this.id=this.$route.params.id;
        this.getnewsinfo();
    },
    methods:{
        getnewsinfo(){
            var url="http://182.254.146.100:8899/api/getnew/"+this.id;

            this.$http.get(url).then(function(res){
                // console.log(res);
                var body = res.body;
                if(body.status!=0){
                    Toast(body.message);
                    return;
                }
                this.info = body.message[0];
                console.log(body);
            })

        }
    }
}
</script>

<style scoped>
.top{
padding: 10px;
}
.top h3{
    color: #0094ff;
}
.top p{
    padding-top: 5px;
    color:darkgray;
}
.content{
    padding: 10px;
}
</style>



